<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>select多选</title>
</head>
<body>

<div id="demo1" class="xm-select-demo"></div>
<button class="btn" id="demo1-getValue">获取选中值</button>





</body>
<script src="{{asset('common/js/jquery-3.4.1.min.js')}}" ></script>
<script src="{{asset('admin/layui/lib/extend/xm-select.js')}}" ></script>
<script>
    var demo1 = xmSelect.render({
        el: '#demo1',
        filterable: true,
        remoteSearch: true,
        language: 'zn',
        tips: '请输入人名',
        {{--data: JSON.parse('{!! $records !!}'),--}}
        remoteMethod: function(val, cb, show){

            if(!val){
                return cb([]);
            }
            $.getJSON("{{url()->current()}}?name="+val,function (res){
                cb(res.data);
            })
        },
    })

    document.getElementById('demo1-getValue').onclick = function(){
        //获取当前多选选中的值
        var selectArr = demo1.getValue();
        document.getElementById('demo1-value').innerHTML = JSON.stringify(selectArr, null, 2);
    }
</script>


</html>
